package com.nf.health.app.activity.home;

import android.os.Bundle;
import android.text.TextUtils;
import android.webkit.WebSettings;
import android.webkit.WebView;
import android.widget.LinearLayout;
import android.widget.TextView;


import com.nf.health.app.MyApplication;
import com.nf.health.app.R;
import com.nf.health.app.activity.global.BaseActivity;
import com.nf.health.app.http.Apis;

import butterknife.Bind;
import butterknife.ButterKnife;

/**
 * 特色科室  详情页面 Ian
 * <p/>
 * Created by Administrator on 2017/4/7.
 */
public class CharacteristicDepartmentResultActivity extends BaseActivity {


    @Bind(R.id.ll_content)
    LinearLayout llContent;
    @Bind(R.id.titlebar_title_tv)
    TextView titlebarTitleTv;


    WebView webview;

    String content,name;

    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setTitleBar(R.layout.titlebar_base);
        setContent(R.layout.layout_activity_characteristic_department_result);
        ButterKnife.bind(this);
        content = getIntent().getStringExtra("url");
        name = getIntent().getStringExtra("name");
        initView();
    }

    private void initView() {
        if(TextUtils.isEmpty(name)){
            titlebarTitleTv.setText("科室详情");
        }else{
            titlebarTitleTv.setText(name);
        }

        webview = new WebView(MyApplication.getInstance());
        llContent.addView(webview);
        WebSettings webSettings = webview.getSettings();
        webSettings.setBuiltInZoomControls(false);//屏幕缩放控件显示
        webSettings.setLayoutAlgorithm(WebSettings.LayoutAlgorithm.NARROW_COLUMNS);
        webSettings.setUseWideViewPort(true);
        webSettings.setJavaScriptEnabled(true);
        webSettings.setSupportZoom(true);//屏幕缩放
        webSettings.setLightTouchEnabled(true);
        webSettings.setAllowFileAccess(true);
        webSettings.setDomStorageEnabled(true);

        webview.loadUrl(content+ Apis.WEBVIEW_PLETEFORM);

    }

}